<extend name="./base" />
<block name="title"><?php echo $_SESSION['username'] ?></block>
<block name="body">
<form class="form-horizontal" method="post">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
    <div class="col-sm-10">
      <input type="text" disabled="true" class="form-control" name="username" id="inputEmail3" value="{$department.username}" placeholder="用户名">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
    <div class="col-sm-10">
      <input type="email" disabled="true" name="email" class="form-control"  value="{$department.email}" placeholder="邮箱">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">机构名称</label>
    <div class="col-sm-10">
      <input type="text" name="Username" class="form-control"  value="{$department.Username}" placeholder="机构名称">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">联系电话</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="phone" value="{$department.phone}" placeholder="电话">
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">所在地点</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="address" value="{$department.address}" placeholder="地点">
    </div>
  </div>
  <div class="form-group">	
    <label for="inputEmail3" class="col-sm-2 control-label">开设课程</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="Subjects_now" value="{$department.Subjects_now}" placeholder="开设的课程">
    </div>
  </div>	 
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">头像</label>
    <div class="col-sm-2">
      <input type="file" id="fileElem" multiple accept="image/*"  onchange="handleFiles(this)" class="form-control" value="" placeholder="头像">
    </div>
    <div class="col-sm-8">
      <div id="fileList">
	  </div>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default">确认修改</button>
    </div>
  </div>
</form>
</block>
<block name="myjs">
<script>
	window.URL = window.URL || window.webkitURL;
	var fileElem = document.getElementById("fileElem"),
	    fileList = document.getElementById("fileList");
	function handleFiles(obj) {
		var files = obj.files,
			img = new Image();
		if(window.URL){
			//File API
			  alert(files[0].name + "," + files[0].size + " bytes");
		      img.src = window.URL.createObjectURL(files[0]); //创建一个object URL，并不是你的本地路径
		      img.width = 200;
		      img.onload = function(e) {
		         window.URL.revokeObjectURL(this.src); //图片加载后，释放object URL
		      }
		      fileList.appendChild(img);
		}else if(window.FileReader){
			//opera不支持createObjectURL/revokeObjectURL方法。我们用FileReader对象来处理
			var reader = new FileReader();
			reader.readAsDataURL(files[0]);
			reader.onload = function(e){
				alert(files[0].name + "," +e.total + " bytes");
				img.src = this.result;
				img.width = 200;
				fileList.appendChild(img);
			}
		}else{
			//ie
			obj.select();
			obj.blur();
			var nfile = document.selection.createRange().text;
			document.selection.empty();
			img.src = nfile;
			img.width = 200;
			img.onload=function(){
		      alert(nfile+","+img.fileSize + " bytes");
		    }
			fileList.appendChild(img);
			//fileList.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src='"+nfile+"')";
		}
	}
</script>	
</block>